package com.TestDemo.Test2;

import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: zjz
 * @Date: 2022/02/17/9:38
 * @Description:
 * @Target:
 */
public class ArrayMidTest {
    public static void main(String[] args) {
        int[] arr1 = new int[]{0,1,2,3};
        int[] arr2 = new int[]{0,1,2,3,5};


        int L = 1;  // 2 的M也是3
        int R = 5;
        int M = L+((R-L)>>1);
        System.out.println(M);  // M为3

        System.out.println("--------");

        for (int i = 0; i < arr1.length/2; i++) {
            System.out.print(arr1[i]);
        }
        System.out.println("------"+arr1.length/2+"------");
        for (int i = arr1.length/2; i < arr1.length; i++) {
            System.out.print(arr1[i]);
        }

        System.out.println();
        for (int i = 0; i < arr2.length/2; i++) {
            System.out.print(arr2[i]);
        }

        System.out.println("------------");
        for (int i = arr2.length/2; i < arr2.length; i++) {
            System.out.print(arr2[i]);
        }
        System.out.println("------------");
        int[] arr3 = new int[]{9,2,6,0,1,2,3,5};
        Arrays.sort(arr3,0,4);

        for (int i = 0; i < arr3.length; i++) {
            System.out.print(arr3[i]);
        }

    }
}
